package com.zan.springcloud.controller;

import com.zan.springcloud.entity.CommonResult;
import com.zan.springcloud.entity.Payment;
import com.zan.springcloud.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author Zan
 * @Create 2023/12/12 20:45
 * @Description :
 */
@RestController
@CrossOrigin
@Slf4j
@RequestMapping("/consumer")
public class OrderFeignController {

    @Resource
    private PaymentFeignService paymentFeignService;

    @GetMapping("/payment/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id) {
        return paymentFeignService.getPaymentById(id);
    }

    @GetMapping("/payment/feign/timeout")
    public String paymentFeignTimeOut() {
        // OpenFeign -- Ribbon  客户端一般默认等待1秒钟
        return paymentFeignService.paymentFeignTimeOut();
    }

}
